{extend name='table'}

{block name="content"}
<div class="layui-card padding-20 shadow layui-card-body" >
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-bg-blue"   data-modal='{:url("add")}?customer_id={$customer_id}'  >新增</button>
    </div>
    <table id="namingTable" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
</div>
{/block}
{block name='script'}
<script>
    $(function () {
        // 初始化表格组件
        $('#namingTable').layTable({
            even: true,
            page: false,
            sort: {field: 'id desc', type: 'desc'},
            where:{customer_id: '{$customer_id}'},
            cols: [[
                {title: '序号', type: 'numbers', width: 60},
                {field: 'title', title: '标题', align: "center", minWidth: 170},
                {field: 'content', title: '专属语句', align: "center", minWidth: 170},
                {field: 'image', title: '图片', align: 'center', minWidth: 140,templet: function (d) {
                        if (!d.image) return '-';
                        return layui.laytpl('<div class="headimg  shadow-inset margin-0" style="width: 150px;height: 50px;border-radius: 0" data-tips-image data-tips-hover data-lazy-src="{{d.image}}"></div>').render(d);
                    }},
                {toolbar: '#toolbarnaming', title: '操作面板', align: 'center', minWidth: 200, fixed: 'right'},
            ]]

        });



    });

</script>

<!-- 数据操作工具条模板 -->
<script type="text/html" id="toolbarnaming">
    <!--{if auth("edit") }-->
    <a class="layui-btn  layui-btn-sm" data-modal='{:url("edit")}?id={{d.id}}&customer_id={$customer_id}'>编 辑</a>
    <!--{/if}-->
    <!--{if auth("remove")}-->
    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="{:lang('确定要删除吗？')}" data-action="{:url('remove')}" data-value="id#{{d.id}}">{:lang('删 除')}</a>
    <!--{/if}-->

</script>
{/block}
